import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *



testCase = "DBshop005_订单管理查询"
# 获取项目的绝对路径
rootPath = get_pro_rootpath()
print(rootPath)
filePath = rootPath+r'\public\order1.txt' #
print(filePath)  # 拼接文件路径
orderN5 = readFile(filePath)  # 读取文件内容
print(orderN5)
# 1.点击销售管理订单管理界面。
firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"销售管理","订单管理")
# 2.在订单号查询框输入“1668236166580002”，点击“搜索”按钮。
# DBshopSearchOrderID(firefox,orderN5) # 调用自定义函数进行订单的输入和查询
# 检查点，订单数是 1
# s = firefox.find_element_by_xpath("//body").text
# # print(s)
# l = '订单数:'
# r = "\)"
# num=reGetString(s,l,r)
li = firefox.find_elements_by_xpath('//tr/td[2]')
try:
    for i in li:
        if orderN5 in i.text:
            writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
# firefox.quit()

# try:
#     firefox.find_element_by_xpath('//tr/td[2]').text
#     writeLog("%s 测试通过" % testCase)
# except:
#         writeLog("%s 测试失败" % testCase)
#         getPhoto(firefox)
# firefox.quit()

